package com.obas.menus {
	import com.ease.core.components.menus.AbstractMenuProvider;
	import com.ease.core.components.menus.IMenuProvider;

	import mx.events.MenuEvent;

   public class MenuBarProvider extends AbstractMenuProvider {
		public var fileMenuProvider:IMenuProvider = new FileMenuProvider();

		public var editMenuProvider:IMenuProvider = new EditMenuProvider();

		public var sourceMenuProvider:IMenuProvider = new SourceMenuProvider();

		public var navigateMenuProvider:IMenuProvider = new NavigateMenuProvider();

		public var searchMenuProvider:IMenuProvider = new SearchMenuProvider();

		public var projectMenuProvider:IMenuProvider = new ProjectMenuProvider();

		public var dataMenuProvider:IMenuProvider = new DataMenuProvider();

		public var runMenuProvider:IMenuProvider = new RunMenuProvider();

		public var windowMenuProvider:IMenuProvider = new WindowMenuProvider();

		public var helpMenuProvider:IMenuProvider = new HelpMenuProvider();

		public function MenuBarProvider() {
			super();
		}

		override public function appendMenuItem(root:Object):void {
			fileMenuProvider.appendMenuItem(root);
			editMenuProvider.appendMenuItem(root);
			sourceMenuProvider.appendMenuItem(root);
			navigateMenuProvider.appendMenuItem(root);
			searchMenuProvider.appendMenuItem(root);
			projectMenuProvider.appendMenuItem(root);
			dataMenuProvider.appendMenuItem(root);
			runMenuProvider.appendMenuItem(root);
			windowMenuProvider.appendMenuItem(root);
			helpMenuProvider.appendMenuItem(root);
		}

		private function retrieveListenerFunction(item:Object):Function {
			if (null != item) {
				if (item[LISTENER] == "undefined") {
				}
				else {
					return item[LISTENER];
				}
			}
			return null;
		}

		override public function onMenuItemClick(event:MenuEvent):void {
			var fun:Function = retrieveListenerFunction(event.item);
			if (null != fun) {
				fun(event);
			}
		}
	}
}